<%--
  Created by IntelliJ IDEA.
  User: 陌·笙
  Date: 2019-01-15
  Time: 9:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>营业统计</title>
    <jsp:include page="/comm/tag.jsp"></jsp:include>
</head>
<body>
<div style="margin-left: 50px;margin-right: 50px; padding-top: 50px ">
    <div class="col-md-6">
        <div id="six" class="col-md-12" style="height:400px; "></div>
    </div>
    <script>
        // 基于准备好的dom，初始化echarts实例
        var myCharts = echarts.init(document.getElementById('six'));
        //设置等待图
        myCharts.showLoading();
        option = {
            title : {
                text: '今年和上年的收入',
                subtext: '比率',
                x:'center'
            },
            tooltip : {
                trigger: 'item',
                formatter: "{a} <br/>{b} : {c} ({d}%)"
            },
            legend: {
                orient: 'vertical',
                left: 'left',
                data: []
            },
            series : [
                {
                    name: '访问来源',
                    type: 'pie',
                    radius : '55%',
                    center: ['50%', '60%'],
                    data:[],
                    itemStyle: {
                        emphasis: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        };
        myCharts.setOption(option);
        $.post('/tongji/yingye',function (data){
            var name=data.xq;
            var count =data.count;
            var service=[];
            for (var i=0;i<name.length;i++){
                var obj=new Object();
                obj.name=name[i];
                obj.value=count[i];
                service[i]=obj;
            }
            myCharts.setOption({        //加载数据图表                
                legend: {
                    data: name
                },
                series: [{
                    data: service
                }]
            });
            //隐藏等待图
            myCharts.hideLoading();
        }) ;
    </script>
    <div class="col-md-6">
        <div id="two" class="col-md-12" style="height:400px; "></div>
    </div>
    <script>
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('two'));
        //设置等待图
        myChart.showLoading();
        option = {
            title : {
                text: '今年和上年的销量',
                subtext: '比率',
                x:'center'
            },
            tooltip : {
                trigger: 'item',
                formatter: "{a} <br/>{b} : {c} ({d}%)"
            },
            legend: {
                orient: 'vertical',
                left: 'left',
                data: []
            },
            series : [
                {
                    name: '访问来源',
                    type: 'pie',
                    radius : '55%',
                    center: ['50%', '60%'],
                    data:[],
                    itemStyle: {
                        emphasis: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        };
        myChart.setOption(option);
        $.post('/tongji/yingyes',function (data){
            var name=data.xq;
            var count =data.count;
            var service=[];
            for (var i=0;i<name.length;i++){
                var obj=new Object();
                obj.name=name[i];
                obj.value=count[i];
                service[i]=obj;
            }
            myChart.setOption({        //加载数据图表                
                legend: {
                    data: name
                },
                series: [{
                    data: service
                }]
            });
            //隐藏等待图
            myChart.hideLoading();
        }) ;
    </script>
</div>


</body>
</html>
